package cn.readjava.service.impl;

import cn.readjava.bean.RolePermission;
import cn.readjava.dao.RolePermissionDao;
import cn.readjava.service.RolePermissionService;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@CacheConfig(cacheNames = "rolePermission")
public class RolePermissionServiceImpl implements RolePermissionService {

    @Resource
    private RolePermissionDao rolePermissionDao;

    @Override
    @Cacheable(key = "'rolePermission ' + #p0")
    public List<RolePermission> findAllByRId(Long roleId) {
        return rolePermissionDao.findAllByRId(roleId);
    }
}
